using System;
using System.Linq;
using log4net;
using FoundationLib.Ifc.Logging;

namespace FoundationLib.Logging 
{
	/// <summary>
	/// This special kind of logger uses log4net for logging.
	/// </summary>
	public class Log4NetLogger : TechnicalLogger 
	{
		/// <summary>
		/// The log4net logger
		/// </summary>
		private ILog logger;


		/// <summary>
		/// Creates a new log4net logger.
		/// </summary>
		/// <param name="logger">The logger</param>
		/// <exception cref="ArgumentNullException">Logger contains a null-reference.</exception>
		public Log4NetLogger(ILog logger)
		{
			if (logger == null)
				throw new ArgumentNullException("logger");

			this.logger = logger;
		}

		/// 
		/// <param name="message"></param>
		public override void Debug(Object message)
		{
			this.logger.Debug(message);
		}

		/// 
		/// <param name="message"></param>
		/// <param name="exception"></param>
		public override void Debug(Object message, Exception exception)
		{
			this.logger.Debug(message, exception);
		}

		/// 
		/// <param name="format"></param>
		/// <param name="args"></param>
		public override void DebugFormat(String format, Object[] args)
		{
			this.logger.DebugFormat(format, args);
		}

		/// 
		/// <param name="message"></param>
		public override void Error(Object message)
		{
			this.logger.Error(message);
		}

		/// 
		/// <param name="message"></param>
		/// <param name="exception"></param>
		public override void Error(Object message, Exception exception)
		{
			this.logger.Error(message, exception);
		}

		/// 
		/// <param name="format"></param>
		/// <param name="args"></param>
		public override void ErrorFormat(String format, Object[] args)
		{
			this.logger.ErrorFormat(format, args);
		}

		/// 
		/// <param name="message"></param>
		public override void Fatal(Object message)
		{
			this.logger.Fatal(message);
		}

		/// 
		/// <param name="message"></param>
		/// <param name="exception"></param>
		public override void Fatal(Object message, Exception exception)
		{
			this.logger.Fatal(message, exception);
		}

		/// 
		/// <param name="format"></param>
		/// <param name="args"></param>
		public override void FatalFormat(String format, Object[] args)
		{
			this.logger.FatalFormat(format, args);
		}

		/// 
		/// <param name="message"></param>
		public override void Info(Object message)
		{
			this.logger.Info(message);
		}

		/// 
		/// <param name="message"></param>
		/// <param name="exception"></param>
		public override void Info(Object message, Exception exception)
		{
			this.logger.Info(message, exception);
		}

		/// 
		/// <param name="format"></param>
		/// <param name="args"></param>
		public override void InfoFormat(String format, Object[] args)
		{
			this.logger.InfoFormat(format, args);
		}

		/// <summary>
		/// Gets the log4net logger.
		/// </summary>
		public ILog Logger
		{
			get
			{
				return this.logger;
			}
		}

		/// 
		/// <param name="message"></param>
		public override void Warn(Object message)
		{
			this.logger.Warn(message);
		}

		/// 
		/// <param name="message"></param>
		/// <param name="exception"></param>
		public override void Warn(Object message, Exception exception)
		{
			this.logger.Warn(message, exception);
		}

		/// 
		/// <param name="format"></param>
		/// <param name="args"></param>
		public override void WarnFormat(String format, Object[] args)
		{
			this.logger.WarnFormat(format, args);
		}

	}

}